import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class NativeRefreshIos extends StatefulWidget {
  @override
  _NativeRefreshStateIos createState() => _NativeRefreshStateIos();
}

class _NativeRefreshStateIos extends State<NativeRefreshIos> {
  Future _onRefresh() async {
    await Future.delayed(Duration(milliseconds: 1500));
  }

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      child: CustomScrollView(
        physics: BouncingScrollPhysics(),
        slivers: [
          CupertinoSliverRefreshControl(
            onRefresh: _onRefresh,
          ),
          SliverList(
            delegate: SliverChildBuilderDelegate(
              (BuildContext context, int index) {
                return ListTile(
                  title: Text('item_$index'),
                );
              },
              childCount: 30,
            ),
          ),
        ],
      ),
    );
  }
}
